#创建浏览器对象
import datetime
import os
import sys

from requests import options
from selenium import webdriver
from selenium.webdriver.ie.service import Service
#from selenium.webdriver.chrome.service import Service
from webdriver_manager.microsoft import EdgeChromiumDriverManager


class Driver:
    driver=""
    def __init__(self):
        options = webdriver.EdgeOptions()
        self.driver = webdriver.Edge(service=Service(EdgeChromiumDriverManager().install()),options=options)
        self.driver.implicitly_wait(10)
    def getScreenshot(self):
 #屏幕截图
     driemane=datetime.datetime.now().strftime("%Y-%m-%d")
     if not os.path.exists("../images/"+driemane):
         os.mkdir("../images/"+driemane)
     filename=sys._getframe().f_back.f_code.co_name+datetime.datetime.now().strftime("%Y-%m-%d-%H%M%S")+".png"
     self.driver.save_screenshot("../images/"+driemane+"/"+filename)

BlogDriver=Driver()